
<%@ page import="net.loststone.Job" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'job.label', default: 'Job')}" />
  <title>PatoPay Jobs</title>
  <g:javascript library="prototype" />
</head>
<body>
  <div class="body">
    <h1>${jobInstanceTotal} ofertas encontradas</h1>
    <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
    </g:if>
    <div class="list">
      <g:each in="${jobInstanceList}" status="i" var="jobInstance">
        <div class="offer">
          <a class="logo-empresa" href="http://infojobs.net">
            <img height="20" src="${resource(dir:'images/thirdparty', file:fieldValue(bean: jobInstance, field: "site")+'.png')}" alt="PatoPay"/>
          </a>

          <span class="explain">¿Qué?:</span><span class="content">${fieldValue(bean: jobInstance, field: "name")}</span>

          <span class="explain">¿Quién?:</span><span class="content">${fieldValue(bean: jobInstance, field: "company")}</span>
          
          <span class="explain">¿Dónde?:</span>
          <span class="hide" class="content">${fieldValue(bean: jobInstance, field: "location")}</span>
          <span class="content"><g:javascript>document.write('${fieldValue(bean: jobInstance, field: "location")}'.truncate(40));</g:javascript></span>

          <span class="explain">¿Cómo?</span>
          <span class="hide" class="content">${fieldValue(bean: jobInstance, field: "description")}</span>
          <span class="content"><g:javascript>document.write('${fieldValue(bean: jobInstance, field: "description")}'.truncate(100));</g:javascript></span>

          <span class="explain">¿Cuánto?:</span><span class="content">${fieldValue(bean: jobInstance, field: "salary") ?: "-"}</span>

          <div class="view-link">
            <a href="${fieldValue(bean: jobInstance, field: "link")}">Ver Oferta</a>
          </div>
        </div>
      </g:each>
    </div>

    <div class="clearfooter"></div>
  </div>

<g:javascript>
  String.prototype.truncate = function(length) {
  if (this.length > length) {
  return this.slice(0, length - 3) + "...";
  } else {
  return this;
  }
  };
</g:javascript>

</body>
</html>
